// /////////////////////////////////////////////////////////////////////////////
//
// Name:            asParticleSysComponent.cpp
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Binds the ParticleSysComponent class to AngelScript
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

// Include files
#include "asParticleSysComponent.h"

#ifdef __COMPILE_WITH_ANGELSCRIPT__

#include "../../ScriptHelper.h"
#include "asSceneComponent.h"

#include "../../../components/scene/ParticleSysComponent.h"


//! Reference factory for the ParticleSysComponent class.
ParticleSysComponent* createParticleSysComponent(Entity *parent, const vector3df &scale)
{
    return new ParticleSysComponent(parent, scale);
}

//! Binds the ParticleSysComponent class to AngelScript.
void bindParticleSysComponent(asIScriptEngine *engine)
{
    // Forward declarations.
    int r;

    // Bind ParticleSysComponent class.
    r = engine->RegisterObjectType("ParticleSysComponent", sizeof(ParticleSysComponent), asOBJ_REF); assert(r >= 0);

    // Bind inherited functions.
    bindSceneComponentBase<ParticleSysComponent>(engine, "ParticleSysComponent");

    // Set SkyboxComponent behaviour.
    r = engine->RegisterObjectBehaviour("ParticleSysComponent", asBEHAVE_FACTORY, "ParticleSysComponent@ f(Entity @+, " \
                                        "const vector3df &in)", asFUNCTIONPR(createParticleSysComponent, (Entity*,
                                        const vector3df&), ParticleSysComponent*), asCALL_CDECL); assert(r >= 0);

    r = engine->RegisterObjectMethod("ParticleSysComponent", "ParticleSysComponent& opAssign(const ParticleSysComponent &in)",
                                     asFUNCTION(assignT<ParticleSysComponent>), asCALL_CDECL_OBJFIRST); assert(r >= 0);

    // Bind ParticleSysComponent class methods.
    r = engine->RegisterObjectMethod("ParticleSysComponent", "void addAttractionAffector(const vector3df &in, f32, " \
                                     "bool, bool, bool, bool)", asMETHOD(ParticleSysComponent, addAttractionAffector),
                                     asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("ParticleSysComponent", "void addFadeOutParticleAffector(const SColor &in, u32)",
                                     asMETHOD(ParticleSysComponent, addFadeOutParticleAffector), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("ParticleSysComponent", "void addGravityAffector(const vector3df &in, u32)",
                                     asMETHOD(ParticleSysComponent, addGravityAffector), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("ParticleSysComponent", "void addRotationAffector(const vector3df &in, const vector3df &in)",
                                     asMETHOD(ParticleSysComponent, addRotationAffector), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("ParticleSysComponent", "void addScaleParticleAffector(const dimension2df &in)",
                                     asMETHOD(ParticleSysComponent, addScaleParticleAffector), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("ParticleSysComponent", "void removeAffectors()",
                                     asMETHOD(ParticleSysComponent, removeAffectors), asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod("ParticleSysComponent", "void setBoxEmitter(const aabbox3df &in, const vector3df &in, " \
                                     "u32, u32, const SColor &in, const SColor &in, u32, u32, s32, " \
                                     "const dimension2df &in, const dimension2df &in)",
                                     asMETHOD(ParticleSysComponent, setBoxEmitter), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("ParticleSysComponent", "void setCylinderEmitter(const vector3df &in, f32, " \
                                     "const vector3df &in, f32, bool, const vector3df &in, u32, u32, " \
                                     "const SColor &in, const SColor &in, u32, u32, s32, const dimension2df &in, " \
                                     "const dimension2df &in)", asMETHOD(ParticleSysComponent, setCylinderEmitter),
                                     asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("ParticleSysComponent", "void setMeshEmitter(const string &in, bool, " \
                                     "const vector3df &in, f32, bool, u32, u32, const SColor &in, const SColor &in, " \
                                     "u32, u32, s32, const dimension2df &in, const dimension2df &in)",
                                     asMETHODPR(ParticleSysComponent, setMeshEmitter, (const std::string&, bool,
                                     const vector3df&, f32, bool, u32, u32, const SColor&, const SColor&, u32, u32, s32,
                                     const dimension2df&, const dimension2df&), void), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("ParticleSysComponent", "void setPointEmitter(const vector3df &in, u32, u32, " \
                                     "const SColor &in, const SColor &in, u32, u32, s32, const dimension2df &in, " \
                                     "const dimension2df &in)", asMETHOD(ParticleSysComponent, setPointEmitter),
                                     asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("ParticleSysComponent", "void setRingEmitter(const vector3df &in, f32, f32, " \
                                     "const vector3df &in, u32, u32, const SColor &in, const SColor &in, " \
                                     "u32, u32, s32, const dimension2df &in, const dimension2df &in)",
                                     asMETHOD(ParticleSysComponent, setRingEmitter), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("ParticleSysComponent", "void setSphereEmitter(const vector3df &in, f32, " \
                                     "const vector3df &in, u32, u32, const SColor &in, const SColor &in, " \
                                     "u32, u32, s32, const dimension2df &in, const dimension2df &in)",
                                     asMETHOD(ParticleSysComponent, setSphereEmitter), asCALL_THISCALL); assert(r >= 0);

    r = engine->RegisterObjectMethod("ParticleSysComponent", "void setParticlesAreGlobal()",
                                     asMETHOD(ParticleSysComponent, setParticlesAreGlobal), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("ParticleSysComponent", "void setParticlesAreGlobal(bool)",
                                     asMETHOD(ParticleSysComponent, setParticlesAreGlobal), asCALL_THISCALL); assert(r >= 0);
    r = engine->RegisterObjectMethod("ParticleSysComponent", "void setParticleSize(const dimension2df &in)",
                                     asMETHOD(ParticleSysComponent, setParticleSize), asCALL_THISCALL); assert(r >= 0);
}

#endif // __COMPILE_WITH_ANGELSCRIPT__

// End of File
